Field is Used as Temporary Variable (FUTV)

Description:

FUTV detects fields that are used as temporary variables. This means that a value assigned to such a field is not used by any method except for the method containing the assignment. A temporary field should be replaced by a local variable. FUTV examines only fields with private and internal access since public and protected fields may be used outside of the analyzed assembly.

Incorrect:

Composite = class

    strict private 
    i:integer;

    public
    procedure resize(size:Rect);
    procedure draw() ;
...
end;

procedure Composite.resize(size:Rect);
var j:integer;
begin
  i := numChildren() - 1;
  for j := 0 to i do getChild(j).resize(size);
end;

procedure Composite.draw() ;
var j:integer;
begin
  i := numChildren() - 1;
  for j := 0 to i do getChild(j).draw();
end;

Correct:

Composite = class

    public
    procedure resize(size:Rect);
    procedure draw() ;
...
end;

procedure Composite.resize(size:Rect);
var j,i:integer;
begin
  i := numChildren() - 1;
  for j := 0 to i do getChild(j).resize(size);
end;

procedure Composite.draw() ;
var j,i:integer;
begin
  i := numChildren() - 1;
  for j := 0 to i do getChild(j).draw();
end;